/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.filter;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author joao
 */
    public class EntityManagerFactorySingleton {  
          
        private static final EntityManagerFactory emf; 
          
        static {  
            try {  
                // Create the SessionFactory from hibernate.cfg.xml  
                emf = Persistence.createEntityManagerFactory("br.finan.0PU");  
            } catch (Throwable ex) {  
                // Make sure you log the exception, as it might be swallowed  
                System.err.println("Initial SessionFactory creation failed." + ex);  
                throw new ExceptionInInitializerError(ex);  
            }  
        }  
          
        public static EntityManagerFactory getEntityManagerFactory() {  
            return emf;  
        }  
    }  
